<?php
if (!defined("PHPUnit_MAIN_METHOD")) {
    define("PHPUnit_MAIN_METHOD", "RssTmpStoreTest::main");
}

require_once "PHPUnit/Framework/TestCase.php";
require_once "PHPUnit/Framework/TestSuite.php";

require_once 'lib/RL/CyrDate.php';
require_once 'lib/RSSAggregator/RssTmpStore.php';
//require_once 'lib/RSSAggregator/RssDownload.php';
require_once 'lib/RSSAggregator/RssItem.php';
require_once 'tests/RssFakes.php';

class RssTmpStoreTest extends PHPUnit_Framework_TestCase {
	
	public function testStructureofRetAll() {
		$this->tmp_store->getAll();
		foreach($this->tmp_store->retAll() as $k=>$rss_items) {
			$this->assertType("array", $rss_items);
			foreach ($rss_items as $i=>$item) {
				$this->assertType("RssItem", $item);
			}
		}
		
	}

    /**
     * Runs the test methods of this class.
     *
     * @access public
     * @static
     */
    public static function main() {
        require_once "PHPUnit/TextUI/TestRunner.php";

        $suite  = new PHPUnit_Framework_TestSuite("RssTmpStoreTest");
        $result = PHPUnit_TextUI_TestRunner::run($suite);
    }

    /**
     * Sets up the fixture, for example, open a network connection.
     * This method is called before a test is executed.
     *
     * @access protected
     */
    protected function setUp() {
    	$dlq = new Model_RssDLQueue();
    	$lw = new RssLibWrapper();
    	$this->tmp_store = new RssTmpStore($dlq, $lw);
    }

    /**
     * Tears down the fixture, for example, close a network connection.
     * This method is called after a test is executed.
     *
     * @access protected
     */
    protected function tearDown() {
    	unset($this->tmp_store);
    }
}

if (PHPUnit_MAIN_METHOD == "RssTmpStoreTest::main") {
    RssTmpStoreTest::main();
}
?>
